<script setup lang="ts">
import {useRouter} from "vue-router";
import HeaderNav from "@/components/HeaderNav.vue";
import {ref} from "vue";

const router = useRouter();
const form = ref({
  password: '',
  newPassword: '',
  confirmPassword: ''
});
// 前往地址列表
const goAddress = () => {
  router.push({ name: "addressList" });
};

</script>

<template>
  <div class="setting">
    <!-- 导航栏 -->
    <div class="header_body">
      <header-nav titelText="修改密码"></header-nav>
    </div>

    <!-- 中间 -->
    <div class="warp_body">
      <div class="user_info__box">
        <van-form @submit="onSubmit">
          <van-cell-group inset>
            <van-field
                v-model="form.password"
                required
                name="当前密码"
                label="当前密码"
                placeholder="请输入当前的密码"
                :rules="[{ required: true, message: '请填写当前的密码' }]"
            />
            <van-field
                v-model="form.newPassword"
                required
                type="password"
                name="新密码"
                label="新密码"
                placeholder="请输入新的密码"
                :rules="[{ required: true, message: '请输入新的密码' }]"
            />
            <van-field
                v-model="form.confirmPassword"
                required
                type="password"
                name="新密码"
                label="新密码"
                placeholder="请再次输入新的密码"
                :rules="[{ required: true, message: '请再次输入新的密码' }]"
            />
          </van-cell-group>
          <div style="margin: 16px;">
            <van-button round block type="primary" native-type="submit">
              提交
            </van-button>
          </div>
        </van-form>
      </div>
    </div>

    <!-- 底部 -->
    <div class="footer_body"></div>
  </div>
</template>

<style scoped lang="less">
.setting {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: #f4f4f4;
  .warp_body {
    .user_info__box {
      position: relative;
      margin: 10px;
      padding: 10px;
      background: #fff;
      border-radius: 6px;
      font-size: 14px;
      color: #aaa;
      .right_box {
        display: flex;
        flex-direction: column;
        height: 100%;
        .name_text {
          margin: auto auto auto 10px;
        }
        .sign_text {
          margin: auto auto auto 10px;
        }
      }
      .addr_cell {
        border-top: 1px solid #eee;
        margin-top: 10px;
        padding-bottom: 0px;
      }
    }
  }
}
</style>
